<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
	<head>
		<jsp:include page="../inc.jsp"></jsp:include>
		<link rel="stylesheet" href="${ctx}/jslib/layui/css/layui.css" media="all">
		<meta http-equiv="X-UA-Compatible" content="edge" />
		<title>提现审核-付款</title>
		<style>
		  ul,li{
            list-style: none;
        }
        a{
            text-decoration: none;
        }
       /* .controlSize{

            min-height:100px;
            _height:100px;
            padding:0;
        }*/
       
   		
   		#tb{
   		overflow:hidden;
   		width:90%;
   		}
   		#tb ul{
   		float:left;
   		padding-left:0px;
   		}
   		#tb .list{
   		width:150px;
   		text-align:center;
   		color:#3989c8;
   		}
   		
   		#tb ul li{
   		border:1px solid #dcdcdc;
   		font-size:12px;
   		height:30px;
   		line-height:30px;
   		}
   		#tb .list_li li{
   		  text-align:center;
   		  border-left:none;
   		  padding-left:30px;
   		  padding-right:30px;
   		}
   		.impt{
   		margin-top:5px;
   		margin-bottom:5px;
   		}
   		.impt li{
   		  width:505px;
   		  height:30px;
   		  line-height:30px;
   		}
   		.textbox{
            height: 20px;
            margin: 0;
            padding: 0 2px;
            box-sizing: content-box;
            border: 1px solid #95B8E7;
            vertical-align: middle;

        }
        .blue_btn{
            border: none;
            border-radius: 3px;
            background-color: #3989c8;
            padding: 10px 10px;
            margin-right:5px;
            color:#fff;
        }
        .sub_btn{
        	width:64px;
            border: none;
            border-radius: 3px;
            background-color: #ff8800;
            padding: 6px 6px;
            margin-right:10px;
            color:#fff;
        }
        .cancel_btn{
        	width:64px;
            border: none;
            border-radius: 3px;
            border:1px solid #b5b5b5;
            padding: 6px 6px;
            margin-right:10px;
            color:#333;
        }
        .panel combo-p{
        	position: absolute;
        	bottom:0;
        	
        }
       #tb .list li + li{
   		 border-top:0px;  
   		}
   		#tb .list_li li + li{
   		 border-top:0px;  
   		}
		</style>
		<script type="text/javascript">
		var payMoney="";	
		$(function(){
			$.ajax({
				type:"get",
				url:'${ctx}/withdrawal/forInfo/${cashNo}?temp='+Math.random(),
				dataType:'json',
				async:true,
				success:function(data){
					a=data;
					if(data.success){
						
						$("#orgName").text(data.obj.orgName);
						$("#username").text(data.obj.username);
						$("#accountBank").text(CommonConverter.toEmptyString(data.obj.accountBank)); //银行名称
						$("#cardID").text(CommonConverter.toEmptyString(data.obj.cardID));
						$("#accountName").text(CommonConverter.toEmptyString(data.obj.accountName));
						$("#cashMoney").text(data.obj.cashMoney);
						$("#applyTime").text(data.obj.applyTime);
						
						//$("#remark").text(CommonConverter.toNullString(data.obj.remark));
					}
				}
			});
			
		});
		var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
		function closeWin(){
			 parent.layer.close(index);
		};
		
		
		function auditPay(){
			
			//验证付款时间  必填
			var  payTime = $("#paymentTime").val();
			if(payTime == null || payTime == "" || payTime == "undefined"){
				layer.alert('请填写付款时间', {
					  title:'友情提醒',
					  skin: 'layui-layer-lan', //样式类名
					  closeBtn: 0
					}, function(index){
						var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
						layer.close(index);
					});
				return;
			}
			
			progressLoad();
			var isValid = $('#dataForm').form('validate');
			if (!isValid) {
				progressClose();
				return;
			}
			
			var param={};//存储所有参数
			var paymentType = $("#paymentType").val(); //支付方式
			var obj = document.getElementById("accountBank1");
			var accountBank = obj.options[obj.selectedIndex].text;
		//	var accountBank = $("#accountBank1").val();   //银行
			var paymentNo = $("#paymentNo").val(); //结算单号
			var paymentTime = $("#paymentTime").val(); //付款时间
			var paymentRemarks = $("#paymentRemarks").val(); //说明
			
			param={"cashNo":"${cashNo}",
					"paymentType":paymentType,
					"paymentBank":accountBank,
					"paymentNo":paymentNo,
					"dataToString":paymentTime,
					"paymentRemarks":paymentRemarks
					};
			//发送ajax请求  
			$.ajax({
				type:"post",
				url:"${ctx}/withdrawal/savePayRecord?temp="+Math.random(),
				dataType:'json',
				//contentType:'application/json;charset=utf-8',
				data:param,
				success:function(data){
					progressClose();
					if(data.success){
						layer.alert('付款成功！',{skin:'layui-layer-lan',title: ['系统提示', 'background-color:#00B2EE; color:#fff;'],closeBtn: 0}, function(index){
							closeWin();
							layer.close(index);
						});
					}else{
						layer.alert("付款失败！");
					}
				},
				error:function(msg){
					progressClose();
					layer.alert("请检查您的网络，并重试！");
				}
			});
		}
		</script>
	</head>
	<body style="padding-left:10px;padding-top:0px;">
	<div id="tb">
		<ul class="list">
			<li>采购商</li>
         	<li>提现申请人</li>
         	<li>申请时间</li>
         	<li>提现金额</li>
         	<li>银行名称</li>
         	<li>持卡人</li>
         	<li>卡号</li>
        <!--   	<li>备注</li>  -->
		</ul>
         <ul class="list_li">
         	<li id="orgName"></li>
         	<li id="username"></li>
         	<li id="applyTime"></li>
         	<li id="cashMoney"></li>
         	<li id="accountBank"></li>
         	<li id="accountName"></li>
         	<li id="cardID"></li>
         <!--  	<li id="remark"></li> -->
         </ul>
     </div> 
    <form id="dataForm">
       <table border="0" style="margin-bottom: 50px">
       	<tr>
       		<td align="right"><span style="color:red;">*</span>支付方式：</td>
       		<td>
       		<select id="paymentType"  style="width:300px;height:25px;" class="textbox">
                    <option value="0">现金</option>
                    <option value="1">支票</option>
                    <option value="2">电汇</option>
                    <option value="3">对公汇款</option>
                    <option value="4">对私汇款</option>
                    <option value="5">现金支票</option>
                    <option value="6">转账支票</option>
                </select>
       		</td>
       	</tr>
       	<tr>
       		<td align="right">银行：</td>
       		<td>
       			<select id="accountBank1" style="width:300px;height:25px;" class="textbox" selected="selected">
                    <option value="1">上海浦东发展银行股份有限公司天津科技支行</option>
                </select>
       		</td>
       	</tr>
       	<tr>
       		<td align="right">结算单号：</td>
       		<td>
       		<input id="paymentNo" style="width:295px;height:20px" type='text' class="easyui-validatebox textbox" data-options="'required':true"/>
       		</td>
       	</tr>
       	<tr>
       		<td align="right"><span style="color:red;">*</span>付款时间：</td>
       		<td>
       		<input id="paymentTime" onfocus="new WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
       				style="width:295px;height:20px;" class="textbox">

       		</td>
       	</tr>
       	<tr>
       		<td align="right">说明：</td>
       		<td>
	       		<textarea id="paymentRemarks" rows="3" cols="70" style="border:1px solid #95B8E7"></textarea>
       		</td>
       	</tr>
       	<tr>
       		<td colspan="2" align="center">
       			<input type="button" value="提交" class="sub_btn" id="submit" onclick="auditPay()"/>
       			<input type="button" value="取消" class="cancel_btn" id="close" onclick="closeWin()"/>
       		</td>
       	</tr>
       </table>
  	 </form>
  	  <script type="text/javascript" src="${ctx}/jslib/layer/layer.js" charset="utf-8"></script>
	</body>
</html>